home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / TESTING / STRUCT1.PAS < prev   
Pascal/Delphi Source File  |  1996-08-16  |  1KB  |  41 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Testing; miscellaneous handling of doubly linked data structures
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDEF, EFLIBDAT, EFLIBTXT, EFLIBOBJ;
  10.  
  11. var Structure : StructureObjectType;
  12.     Node      : LinkageObjectPointerType;
  13.     Data      : string[40];
  14.     Index     : word;
  15.     Memory    : longint;
  16.  
  17.  
  18. begin
  19.      Memory := MemAvail;
  20.      with Structure do begin
  21.           Initialize (SizeOf(Data));
  22.  
  23.           Randomize;
  24.  
  25.           { Generate a structure containing randomly generated data }
  26.           for Index := 1 to 2000 do begin
  27.               Data := StringGeneratedRandomly (Pred(SizeOf(Data)));
  28.               Add (Data);
  29.           end;
  30.  
  31.           WalkUsing (Node, IndexedNode(1), 1998);
  32.  
  33.           if (Elements <> 2000) or (Node <> LastNode^.Predecessor) or not IsIntact then
  34.              WriteLn ('Error in structure!');
  35.  
  36.           Intercept;
  37.      end;
  38.  
  39.      if Memory <> MemAvail then WriteLn ('Error in structure disposal.');
  40.      WriteLn  ('Testing completed.');
  41. end.